package com.shengyin.ec.service.goods;

import java.util.List;

import javax.annotation.Resource;

import org.compass.core.Compass;
import org.compass.core.CompassTemplate;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.shengyin.ec.model.entity.Goods;

@Service("goodsSearchService")
@Transactional
public class GoodsSearchServiceImpl implements GoodsSearchService {

	private CompassTemplate compassTemplate;

	@Resource
	public void setCompass(Compass compass) {
		this.compassTemplate = new CompassTemplate(compass);
	}

	@Override
	public List<Goods> search(String keyword, int firstResult, int maxResult) {
		return compassTemplate.execute(new SearchCallback(keyword, firstResult, maxResult));
	}

}
